package Aaaaaa;

import java.util.Arrays;
import java.util.Scanner;

public class Main12 {
    public static void main(String[] args) {

        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()) {
            int n = sc.nextInt();
            int[] A = new int[n];
            int[] B = new int[n];
            for (int i = 0; i < n; i++) {
                A[i] = yinZi(sc.nextInt());
            }
            for (int i = 0; i < n; i++) {
                B[i] = yinZi(sc.nextInt());
            }
            Arrays.sort(A);
            Arrays.sort(B);
            int count = 0;
            boolean[] flag = new boolean[A.length];
            for (int i = A.length - 1; i >= 0; i--) {
                for (int j = B.length - 1; j >= 0; j--) {
                    if (!flag[j] && A[i] > B[j]) {
                        count++;
                        flag[j] = true;
                        i--;
                        break;
                    }
                    flag[j] = true;
                }
            }
            System.out.println(count);
        }
    }
    private static int yinZi(int n) {
        int count=0;
        for(int i=1;i*i<=n;i++){
            if(n%i==0){
                count+=2;
                if(n/i==i){
                    count--;
                }
            }
        }
        return count;
    }
}
